package main
import (
	"fmt"
	// "math"
)

const Pi = 3.14
const (
	//将1左移100位来创建一个非常大的数字 1后面100个0
	Big = 1 << 100
	//Small = 1 << 1 或 Small = 2
	Small = Big >> 99
)
func needInt(x int) int {
	return x*10 + 1
}
func needFloat(x float64) float64{
	return x * 0.1
}

func main(){
	//类型转换
	// var x, y int = 3, 4
	// var f float64 = math.Sqrt(float64(x*x + y*y))
	// var z uint = uint(f)
	// fmt.Println(x, y, z)//3 4 5

	//类型推导
	//当右值声明了类型，新变量的类型与其相同，未指明时取决于常量精度
	// v := 42         //int
	// v := 3.142     //float64
	// v := 0.867 + 0.5i //complex128
	// fmt.Printf("v is of type %T\n", v)

	//常量
	//常量的声明与变量类似，使用const关键字
	//可以是字符、字符串、布尔值或数值
	//常量不能用 := 语法声明
	// const World = "世界"
	// fmt.Println("Hello", World)//Hello 世界
	// fmt.Println("Happy",Pi,"Day")//Happy 3.14 Day
	// const Truth = true
	// fmt.Println("Go rules?", Truth)//Go rules? true

	//数值常量
	fmt.Println(needInt(Small))//21
	fmt.Println(needFloat(Small))//0.2
	fmt.Println(needFloat(Big))//1.2676506002282295e+29

//cannot use Big (untyped int constant 1267650600228229401496703205376) as int value in argument to needInt (overflows)
	fmt.Println(needInt(Big))

}

